<?php

namespace app\common\service\order\order_status;

use app\common\service\order\order_status\items\OrderStatusCancel;
use app\common\service\order\order_status\items\OrderStatusInvalid;
use app\common\service\order\order_status\items\OrderStatusFinish;
use app\common\service\order\order_status\items\OrderStatusPay;
use app\common\service\order\order_status\items\OrderStatusRefund;
use app\common\service\order\order_status\items\OrderStatusRefundIng;
use app\common\service\order\order_status\items\OrderStatusSettle;
use app\common\service\order\order_status\items\OrderStatusWaitPay;
use app\common\service\order\pipeline\coupon\ProductInfo;
use app\common\service\order\pipeline\coupon\RequestValidate;
use app\model\CouponOrder;
use think\Pipeline;

class OrderStatusService
{

    public function getPips()
    {
        $pips = [
            [OrderStatusCancel::class, 'handle'],//已取消 --
            [OrderStatusWaitPay::class, 'handle'],//待支付
            [OrderStatusFinish::class, 'handle'],//已完成  --
            [OrderStatusSettle::class, 'handle'],//已结算  --
            [OrderStatusPay::class, 'handle'],//已支付 --
            [OrderStatusRefund::class, 'handle'],//已退款 --
            [OrderStatusRefundIng::class, 'handle'],//退款中
            [OrderStatusInvalid::class, 'handle'],//无效订单 --
        ];
        return $pips;
    }


    public function getStatus(CouponOrder $couponOrder)
    {


        $pips = $this->getPips();

        (new Pipeline())
            ->send($couponOrder)
            ->through($pips)
            ->then(function ($e) {
            });

    }
}